<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
  String _id=request.getParameter("_");
  request.setAttribute("now",new Date());
%>

<div class="row">
    <div class="col-lg-12">
        <div class="panel">
            <div class="panel-heading">
                <h3 class="panel-title">会议安排登记表</h3>
            </div>

            <!-- BASIC FORM ELEMENTS -->
            <!--===================================================-->
            <form id="form_meeting_input" class="panel-body form-horizontal form-padding">
                <input type="hidden" name="keyId" id="keyId" value="${meeting.id}" />
                <div class="form-group">
                    <label class="col-md-2 control-label">是否外出会议<i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-10">
                        <input type="text" id="isOut" name="isOut" class="form-control" value="${meeting.isOut==1?"是":"否"}" disabled>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">日程公开<i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-10">
                        <input type="text" id="isPublic" name="isPublic" class="form-control" value="${meeting.isPublic==1?"是":"否"}" disabled>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">会议名称<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-10">
                        <input type="text" id="name" name="name" class="form-control" disabled value="${meeting.name}">
                    </div>
                </div>

                <div class="form-group div-Hidden">
                    <label class="col-md-2 control-label">开始日期<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-4">
                        <div class="input-group date">
                            <input type="text" class="form-control" id="datStart" name="datStart" disabled
                                   value=<fmt:formatDate pattern="yyyy-MM-dd" value="${meeting.datStart}" /> >
                            <span class="input-group-addon"><i class="ti-calendar"></i></span>
                        </div>
                    </div>
                    <label class="col-md-2 control-label">开始时间<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-4">
                        <div class="input-group clockpicker">
                            <input type="text" class="form-control" id="timStart" name="timStart" disabled
                                   value=<fmt:formatDate pattern="HH:mm" value="${meeting.timStart}" /> >
                            <span class="input-group-addon"><i class="ti-alarm-clock"></i></span>
                        </div>
                    </div>
                </div>

                <div class="form-group div-Hidden">
                    <label class="col-md-2 control-label">结束日期<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-4">
                        <div class="input-group date">
                            <input type="text" class="form-control" id="datEnd" name="datEnd" disabled
                                   value=<fmt:formatDate pattern="yyyy-MM-dd" value="${meeting.datEnd}" /> >
                            <span class="input-group-addon"><i class="ti-calendar"></i></span>
                        </div>
                    </div>
                    <label class="col-md-2 control-label">结束时间<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-4">
                        <div class="input-group clockpicker">
                            <input type="text" class="form-control" id="timEnd" name="timEnd" disabled
                                   value=<fmt:formatDate pattern="HH:mm" value="${meeting.timEnd}" /> >
                            <span class="input-group-addon"><i class="ti-alarm-clock"></i></span>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">会议议题<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-10">
                        <input type="text" id="subject" name="subject" class="form-control" disabled value="${meeting.subject}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">
                        会议负责人
                        <i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-10">
                        <input type="text" id="userName" name="userName" class="form-control" disabled value="${meeting.chief.name}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">
                        内部参会人员
                        <i class="fa fa-asterisk txt-color-red"></i>
                    </label>
                    <div class="col-md-10">
                        <input type="text" id="userNames" name="userNames" class="form-control" disabled
                               value="<c:forEach var="item" items="${meeting.participants}" varStatus="status">${item.name}<c:if test="${!status.last}">,</c:if></c:forEach>">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">外部参会人员</label>
                    <div class="col-md-10">
                        <input type="text" id="outermen" name="outermen" class="form-control" disabled value="${meeting.outermen}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">具体地点<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-10">
                        <input type="text" id="address" name="address" class="form-control" disabled value="${meeting.address}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label">会议辅助设备
                        <span style="display: none" id="aidSetsSpan">${meeting.aidSets}</span>
                    </label>
                    <div class="col-md-10">

                        <div class="checkbox">
                            <!-- Inline checkbox buttons -->
                            <input type="checkbox" name="aidSets" id="aidSets1Selected" class="magic-checkbox" value="01" disabled
                            <c:if test="${meeting.aidSets.indexOf('01')>-1}"> checked="checked"</c:if> >
                            <label for="aidSets1Selected">电脑</label>

                            <input type="checkbox" name="aidSets" id="aidSets2Selected" class="magic-checkbox" value="02" disabled
                            <c:if test="${meeting.aidSets.indexOf('02')>-1}"> checked="checked"</c:if> >
                            <label for="aidSets2Selected">投影仪</label>

                            <input type="checkbox" name="aidSets" id="aidSets3Selected" class="magic-checkbox" value="03" disabled
                            <c:if test="${meeting.aidSets.indexOf('03')>-1}"> checked="checked"</c:if> >
                            <label for="aidSets3Selected">激光笔</label>

                            <input type="checkbox" name="aidSets" id="aidSets4Selected" class="magic-checkbox" value="04" disabled
                            <c:if test="${meeting.aidSets.indexOf('04')>-1}"> checked="checked"</c:if> >
                            <label for="aidSets4Selected">白板</label>

                            <input type="checkbox" name="aidSets" id="aidSets5Selected" class="magic-checkbox" value="05" disabled
                            <c:if test="${meeting.aidSets.indexOf('05')>-1}"> checked="checked"</c:if> >
                            <label for="aidSets5Selected">话筒音响</label>

                            <input type="checkbox" name="aidSets" id="aidSets6Selected" class="magic-checkbox" value="06" disabled
                            <c:if test="${meeting.aidSets.indexOf('06')>-1}"> checked="checked"</c:if> >
                            <label for="aidSets6Selected">人名牌</label>

                            <input type="checkbox" name="aidSets" id="aidSets7Selected" class="magic-checkbox" value="07" disabled
                            <c:if test="${meeting.aidSets.indexOf('07')>-1}"> checked="checked"</c:if> >
                            <label for="aidSets7Selected">其他</label>

                        </div>
                    </div>
                </div>

                <div class="form-group" id="otherSetDiv">
                    <label class="col-md-2 control-label">其他辅助设备<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-10">
                        <input type="text" id="otherSet" name="otherSet" class="form-control" disabled value="${meeting.otherSet}">
                    </div>
                </div>

<c:if test="${meeting.txtStatus.equals('已取消')}">
                <div class="form-group">
                    <label class="col-md-2 control-label">取消原因<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-10">
                        <input type="text" id="cancelReason" name="cancelReason" class="form-control" disabled value="${meeting.cancelReason}">
                    </div>
                </div>
</c:if>

                <div class="form-group">
                    <label class="col-md-2 control-label">提交人</label>
                    <div class="col-md-4">
                        <p class="form-control-static">${meeting.creater.name}</p>
                    </div>
                    <label class="col-md-2 control-label">提交日期</label>
                    <div class="col-md-4">
                        <p class="form-control-static"><fmt:formatDate pattern="yyyy-MM-dd" value="${meeting.dateApply}" /></p>
                    </div>
                </div>

                <div class="panel-footer">
                    <%--<a class="btn btn-default" id="apply-re-common" href="javascript:void(0)">--%>
                        <%--<i class="fa fa-lg fa-mail-reply"></i> 返回--%>
                    <%--</a>--%>
                    <%--<a class="btn btn-default" key="ajax_edit" href="javascript:void(0);" ${isEdit}>--%>
                        <%--<i class="fa fa-lg fa-edit"></i> 编辑--%>
                    <%--</a>--%>
                    <c:if test="${meeting.processState=='Finished'}">
                        <a class="btn btn-warning" key="ajax_meeting_cancel" href="javascript:void(0);"><i class="fa fa-lg fa-minus"></i> 会议取消 </a>
                        <a class="btn btn-warning" key="ajax_meeting_edit" href="javascript:void(0);"><i class="fa fa-lg fa-edit"></i> 会议调整 </a>
                    </c:if>
                </div>

            </form>
            <!--===================================================-->
            <!-- END BASIC FORM ELEMENTS -->

        </div>
    </div>
</div>

<script>
    function fn_meeting_cancel_submit(keyId, reason){
        //ajax执行返回时触发
        var url = '<%=path %>/com/meeting/cancel';
        var data = { keyId: keyId, cancelReason: reason};
        __ajax_post(url, data, function(data){
            __toastr(data);
            if(data.state == 1) {
                // 关闭弹出的对话框
                dialogModal.close();
                // 刷新日程安排
                $('#calendar').fullCalendar('refetchEvents');
            }
        });
    }

    $("a[key='ajax_meeting_cancel']").unbind("click").bind("click",function(){
        __confirm_dialog_input('取消原因', '请输入取消原因', "", function (dialogRef, inputValue) {
            if (inputValue) {
                dialogRef.close();

                fn_meeting_cancel_submit($("#keyId").val(), inputValue);
            } else {
                dialogRef.enableButtons();

                __toastr_warning('请输入取消原因');
            }
        });

    });

    //编辑
    $("a[key='ajax_meeting_edit']").unbind("click").bind("click",function(){
        __confirm_dialog("提示：","确定要修改会议吗？",
            function () {
                // 关闭弹出的对话框
                dialogModal.close();
                // 加载编辑页面
                loadURL("<%=path%>/com/meeting/input?keyId="+$("#keyId").val()+"&meet=1",$('#page-content'));
            }
        )
    });

    // 加载完成后执行
    $(function(){
        var aidSets = $("#aidSetsSpan").text();
        if(aidSets.indexOf("07")>-1){
            $("#otherSetDiv").show();
        } else {
            $("#otherSetDiv").hide();
        }
    })

</script>




